package com.gsx.dao;

import com.gsx.entity.Product;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;


import java.util.List;

/**
 * 自定义的基本查询不需要自己去实现，但要求其命名时严格按照springData提供的关键字规范进行命名
 */
@Repository
public interface ProductDao extends ElasticsearchRepository<Product, Long>{

    List<Product> findByTitle(String title);

    List<Product> findByPriceBetween(double price1, double price2);

    Page<Product> findAllByCategoryOrderById(String category, Pageable pageable);
}
